<?php

namespace Util;

class User
{

    /**
     * 加密密码.
     *
     * @param string $password 密码.
     *
     * @return string
     */
    public static function encodePassword($password) {
        $factor = 'abcedfgeee';
        return md5(md5($password) . $factor);
    }

    public static function getUserPhoto($photo, $width, $height) {
        $pathInfo = pathinfo($photo);
        $host = \Entity\Domain::instance()->www;
        $nowFile =  $host . '/' . $pathInfo['dirname'] . '/' . $pathInfo['filename'] . '_' . $width . '_' . $height . '.' . $pathInfo['extension'];
        return $nowFile;
    }

    public static function getPhoto($photo) {
        $pathInfo = pathinfo($photo);
        $host = \Entity\Domain::instance()->www;
        $nowFile =  $host . '/' . $pathInfo['dirname'] . '/' . $pathInfo['filename'] .'.' . $pathInfo['extension'];
        return $nowFile;
    }
}